Learn R Programming

corrfuns (version 1.2)

Hypothesis test for equality of two correlation coefficients: Hypothesis test for equality of two correlation coefficients

Description

Hypothesis test for equality of two correlation coefficients.

Usage

correls2.test(r1, r2, n1, n2, type = "pearson")

Value

The test statistic and its associated p-value for the test of equal correlations.

Arguments

r1

The value of the first correlation coefficient.

r2

The value of the second correlation coefficient.

n1

The sample size of the first sample from which the first correlation coefficient was computed.

n2

The sample size of the second sample from which the first correlation coefficient was computed.

type

The type of correlation coefficients, "pearson" or "spearman".

Author

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Details

The test statistic for the hypothesis of equality of two correlation coefficients is the following: $$ Z=\frac{\hat{z}_1-\hat{z}_2}{\sqrt{1/\left(n1-3\right)+1/\left(n2-3\right)}}, $$ where \(\hat{z}_1\) and \(\hat{z}_2\) denote the Fisher's transformation (see correl applied to the two correlation coefficients and \(n_1\) and \(n_2\) denote the sample sizes of the two correlation coefficients. The denominator is the sum of the variances of the two coefficients and as you can see we used a different variance estimator than the one we used before. This function performs hypothesis testing for the equality of two correlation coefficients. The result is the calculated p-value from the standard normal distribution.

See Also

correl, correls

Examples

Run this code
y <- rnorm(40)
x <- matrix(rnorm(40 * 1000), ncol = 1000)
a <- correls(y, x )

Run the code above in your browser using DataLab